Socket
Socket
Sign inDemoInstall

@types/command-line-args

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/command-line-args

TypeScript definitions for command-line-args


Version published
Weekly downloads
408K
increased by5.2%
Maintainers
1
Weekly downloads
 
Created

What is @types/command-line-args?

@types/command-line-args provides TypeScript type definitions for the command-line-args package, which is used to parse command-line arguments in Node.js applications.

What are @types/command-line-args's main functionalities?

Define Command Line Options

This feature allows you to define the command-line options your application will accept. In this example, 'file' is a string option and 'verbose' is a boolean option.

const commandLineArgs = require('command-line-args');
const optionDefinitions = [
  { name: 'file', type: String },
  { name: 'verbose', type: Boolean }
];
const options = commandLineArgs(optionDefinitions);
console.log(options);

Default Option Values

You can set default values for options. In this example, if 'file' or 'verbose' are not provided, they will default to 'default.txt' and 'false' respectively.

const commandLineArgs = require('command-line-args');
const optionDefinitions = [
  { name: 'file', type: String, defaultValue: 'default.txt' },
  { name: 'verbose', type: Boolean, defaultValue: false }
];
const options = commandLineArgs(optionDefinitions);
console.log(options);

Multiple Option Values

This feature allows you to accept multiple values for a single option. In this example, 'files' can accept multiple string values.

const commandLineArgs = require('command-line-args');
const optionDefinitions = [
  { name: 'files', type: String, multiple: true }
];
const options = commandLineArgs(optionDefinitions);
console.log(options);

Other packages similar to @types/command-line-args

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc